<%--
  Created by IntelliJ IDEA.
  User: 49020
  Date: 2021/5/19
  Time: 10:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <title>list</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/bootstrap.min.css">
</head>
<body>
<div class="container">
    <div class="row col-md-10 col-md-offset-1">
        <p><a class="btn btn-primary" href="/submit.jsp">添加</a></p>
        <table border="1" class="table table-bordered table-striped">
            <tr>
                <td>编号</td>
                <td>姓名</td>
                <td>性别</td>
                <td>薪资</td>
                <td>密码</td>
                <td>部门</td>
                <td>生日</td>
                <td>操作</td>
            </tr>
            <c:forEach items="${emps.list}" var="emp">
                <tr>
                    <td>${emp.eno}</td>
                    <td>${emp.ename}</td>
                    <td>${emp.esex}</td>
                    <td>${emp.salary}</td>
                    <td>${emp.pwd}</td>
                    <td>${emp.dept.dname}</td>
                    <td>${emp.borndateStr}</td>
                    <td><a class="btn btn-danger" href="/emp/delete?eno=${emp.eno}">删除</a>&nbsp;&nbsp;<a
                            class="btn btn-warning" href="/emp/toUpdate?eno=${emp.eno}">修改</a></td>
                </tr>
            </c:forEach>
            <tr>
                <td colspan="8">
                    <a class="btn btn-info" href="/emp/list?pageIndex=1">首页</a>
                    <a class="btn btn-info"
                       href="/emp/list?pageIndex=<c:if test='${emps.prePage<=0}'>1</c:if><c:if test='${emps.prePage>0}'>${emps.prePage}</c:if>">上一页</a>
                    <c:forEach end="${emps.pages}" var="pageIndex" begin="1">
                        <a class="btn btn-info" href="/emp/list?pageIndex=${pageIndex}">${pageIndex}</a>
                    </c:forEach>
                    <a class="btn btn-info"
                       href="/emp/list?pageIndex=<c:if test='${emps.nextPage>=emps.pages}'>${emps.pages}</c:if><c:if test='${emps.nextPage<emps.pages}'>${emps.nextPage}</c:if>">下一页</a>
                    <a class="btn btn-info" href="/emp/list?pageIndex=${emps.pages}">尾页</a>
                </td>
            </tr>
        </table>


    </div>
</div>
</body>
</html>

